package com.homework.school;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/26 19:02
 * @description
 */
public class Undergraduate extends Student{

    private String specialty;

    public Undergraduate() {
    }

    public Undergraduate(String name, int age, String degree, String specialty) {
        super(name, age, degree);
        this.specialty = specialty;
    }

    public String getSpecialty() {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }

    public void getInfo(){
        System.out.println("姓名："+getName()+"\n" +
                "年龄："+getAge()+"\n" +
                "学位："+getDegree()+"\n" +
                "专业："+specialty+"\n");
    }

    @Override
    public String toString() {
        return "Undergraduate{" +
                "specialty='" + specialty + '\'' +
                '}';
    }
}
